//
// Created by jsjxsy on 2022/8/19.
//operator type() const;
//
#include <iostream>
using namespace std;
#include <cctype>
class SmallInt {
 public:
  SmallInt(int val = 0) : val(val) {
    if (val < 0 || val > 255) {
      throw std::out_of_range("bad smallInt value");
    }
  }
  explicit operator int() { return val; }
 private:
  size_t val;
};
int main() {
  SmallInt i = 3;
  //i+3;//隐式调用 不行
  SmallInt i2 = static_cast<int>(i) + 3;
  cout << "i2=" << static_cast<int>(i2) << endl;
  return 0;
}
